package com.gitee.wsl.struct.element.selection

import com.gitee.wsl.struct.element.Element

 open class Selection<E : Element, D>(
     val groups: List<Group<E, D>>,
)

 class UpdateSelection<E : Element, D>(
    groups: List<Group<E, D>>,
     val enter: EnterSelection<D>,
     val exit: ExitSelection<E, D>,
) : Selection<E, D>(groups)

 class EnterSelection<D>(
    groups: List<Group<EnterElement, D>>,
) : Selection<EnterElement, D>(groups)

 class ExitSelection<E : Element, D>(
    groups: List<Group<E, D>>,
) : Selection<E, D>(groups)

/**
 * See analogous [d3 function](https://github.com/d3/d3-selection#selection). Note that an
 * explicit root must be specified, because there's no global document object here.
 */
 fun <E : Element> E.asSelection(): Selection<E, Nothing?> =
    Selection(listOf(Group(null, listOf(this))))
